﻿using System.Collections.Generic;
using System;

namespace Commons.Models.Stats
{
	[Serializable]
	public class StatUnit : IStatUnit
	{
		protected static Dictionary<string, StatUnit> register = new Dictionary<string, StatUnit>();

		public string Name { get; private set; }

		protected StatUnit(string name)
		{
			this.Name = name;

			register.Add(name, this);
		}

		public static StatUnit GetByName(string name)
		{
			return register.ContainsKey(name) ? register[name] : null;
		}

		public override string ToString()
		{
			return Name;
		}

		public static StatUnit Credits = new StatUnit("credits");
		public static StatUnit Xp = new StatUnit("xp");
		public static StatUnit Lifes = new StatUnit("lifes");
		public static StatUnit Floor = new StatUnit("floor");
		public static StatUnit Score = new StatUnit("score");
	}
}
